﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class ServicesGovernmentDistrict : District
{
    public ServicesGovernmentDistrict(City city)
        : base(DistrictType.Services, city)
    {
    }

    protected override bool IsCompleteDistrict(Dictionary<Building.BuildingType, int> typesInDistrict)
    {
        bool hasHospital = typesInDistrict.ContainsKey(Building.BuildingType.Hospital);
        bool hasPolice = typesInDistrict.ContainsKey(Building.BuildingType.PoliceStation);
        bool hasFire = typesInDistrict.ContainsKey(Building.BuildingType.FireStation);
        bool hasCapital = typesInDistrict.ContainsKey(Building.BuildingType.Capital);
        bool hasCourthouse = typesInDistrict.ContainsKey(Building.BuildingType.Courthouse);

        // Note that a prison is not required to complete the district.

        return hasHospital && hasPolice && hasFire && hasCapital && hasCourthouse;
    }

    protected override bool IsValidBuildingType(Building.BuildingType buildingType)
    {
        if (buildingType == Building.BuildingType.Hospital) return true;
        if (buildingType == Building.BuildingType.PoliceStation) return true;
        if (buildingType == Building.BuildingType.FireStation) return true;
        if (buildingType == Building.BuildingType.Capital) return true;
        if (buildingType == Building.BuildingType.Courthouse) return true;
        if (buildingType == Building.BuildingType.Prison) return true;

        return false;
    }

    protected override float GetDistrictScore(List<Building> buildings)
    {
        float districtScore = 40;

        if (buildings.Any(b => b.type == Building.BuildingType.Prison)) districtScore += 5;

        return districtScore;
    }
}
